﻿Namespace EIBData.DPT
    Public NotInheritable Class EIBDataDPT_16_000
        Inherits EIBDataDPT_16_Base

        Private _value As String

        Sub New(data As Byte())
            MyBase.New(data)

            _value = System.Text.Encoding.ASCII.GetChars(_valueBase)
            _value = _value.Replace(Chr(0), "")
        End Sub

        Sub New(value As String)
            MyBase.New(System.Text.Encoding.ASCII.GetBytes(value))
        End Sub


        Public Overrides Function ToString() As String
            Return _value
        End Function

        Public Overrides Function ToObject() As Object()
            Return New Object() {_value}
        End Function

        Public Overrides ReadOnly Property ObjectType As System.Type()
            Get
                Return New Type() {GetType(String)}
            End Get
        End Property

        Public Overrides Function ToInfoList() As List(Of EIB.InfoBase)
            Dim list As New List(Of EIB.InfoBase)

            list.Add(New EIB.Info("Type", DPT_Name))
            list.Add(New EIB.Info("String", _value))

            Return list
        End Function

        Public Shared Shadows ReadOnly Property DPT_Name As String
            Get
                Return "DPT_String_ASCII"
            End Get
        End Property

        Public Shared Shadows ReadOnly Property DPT_Number As String
            Get
                Return "16.000"
            End Get
        End Property
    End Class
End Namespace